﻿<Windows:BookvarToolWindow
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:aw="clr-namespace:Assergs.Windows;assembly=Assergs.Windows"
    xmlns:nud="clr-namespace:Microsoft.Samples.KMoore.WPFSamples.NumericUpDownControl;assembly=J832.Wpf.BagOTricksLib"
    xmlns:Windows="clr-namespace:BookvarWpf.Windows;assembly="
    xmlns:r="clr-namespace:Bookvar.UI.Localization;assembly=Bookvar.UI"
	x:Class="BookvarWpf.Windows.OptionsWindow"
	Header="{r:Resources OptionsHeaderText}"
	Icon="pack://application:,,,/BookvarWPF;component/Resources/Icons/16x16/Options16.png"
	Style="{DynamicResource {x:Type aw:ToolWindow}}"
	Width="600" Height="300"
    Background="{StaticResource ListBackground}"
	>

    <Windows:BookvarToolWindow.InputBindings>
        <KeyBinding Command="aw:ToolWindow.CloseCommand" Key="Escape" />
    </Windows:BookvarToolWindow.InputBindings>
    <Grid Margin="5">
        <Grid.Resources>
            <Style TargetType="{x:Type TextBox}">
                <Setter Property="HorizontalContentAlignment" Value="Left" />
                <Setter Property="BorderThickness" Value="0,0,0,0" />
                <Setter Property="Margin" Value="2,2,2,2" />
                <Setter Property="Background" Value="Transparent" />
                <Setter Property="Width" Value="150" />
            </Style>

            <Style TargetType="{x:Type Border}">
                <Setter Property="HorizontalAlignment" Value="Left" />
                <Setter Property="VerticalAlignment" Value="Center" />
                <Setter Property="BorderBrush" Value="#FF85A7DB" />
                <Setter Property="Background" Value="#FFF0F7FF" />
                <Setter Property="CornerRadius" Value="5,5,5,5" />
                <Setter Property="Margin" Value="2,2,2,2" />
                <Setter Property="BorderThickness" Value="1,1,1,1" />
            </Style>

            <Style TargetType="{x:Type Label}">
                <Setter Property="FontFamily" Value="Verdana" />
                <Setter Property="FontSize" Value="10" />
                <Setter Property="Foreground" Value="#FF3E6494" />
                <Setter Property="HorizontalContentAlignment" Value="Left" />
            </Style>
            <Style TargetType="{x:Type nud:NumericUpDown}">
                <Setter Property="HorizontalAlignment" Value="Center"/>
                <Setter Property="VerticalAlignment" Value="Center"/>
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type nud:NumericUpDown}">
                            <Grid >
                                <Grid.Resources>

                                    <Style TargetType="{x:Type Border}">
                                        <Setter Property="HorizontalAlignment" Value="Left" />
                                        <Setter Property="VerticalAlignment" Value="Center" />
                                        <Setter Property="BorderBrush" Value="#FF85A7DB" />
                                        <Setter Property="Background" Value="#FFF0F7FF" />
                                        <Setter Property="CornerRadius" Value="5,5,5,5" />
                                        <Setter Property="Margin" Value="2,2,2,2" />
                                        <Setter Property="BorderThickness" Value="1,1,1,1" />
                                    </Style>
                                </Grid.Resources>
                                <Grid.RowDefinitions>
                                    <RowDefinition/>
                                </Grid.RowDefinitions>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition/>
                                    <ColumnDefinition/>
                                </Grid.ColumnDefinitions>
                                <Border Grid.RowSpan="2" VerticalAlignment="Center" Width="22" Height="22" >
                                    <TextBlock Text="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Value}"   Width="20" Height="20" Padding="0,0,5,0" TextAlignment="Right" />
                              </Border>
                                <StackPanel Grid.Column="1" Grid.Row="0">
                                    <RepeatButton Margin="0" Padding="0" Command="{x:Static nud:NumericUpDown.IncreaseCommand}" Width="15" Height="15" >
                                        <Image Source="pack://application:,,,/BookvarWPF;component/Resources/Icons/32x32/SmallUpArrow.png"  />
                                    </RepeatButton>
                                    <RepeatButton Margin="0" Padding="0"  Command="{x:Static nud:NumericUpDown.DecreaseCommand}" Width="15" Height="15" >
                                        <Image Source="pack://application:,,,/BookvarWPF;component/Resources/Icons/32x32/SmallDownArrow.png" />

                                    </RepeatButton>
                                </StackPanel>
                            </Grid>

                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
        </Grid.Resources>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="Auto" />

        </Grid.ColumnDefinitions>

        <Label Grid.Column="0" Grid.Row="0" Content="{DynamicResource {r:Resources OptionsSiteAddressText}}" />
        <Border Grid.Column="1" Grid.Row="0"  >
            <TextBox Name="tbSiteAddress" />
        </Border>

        <Label Grid.Column="0" Grid.Row="1" Content="{r:Resources OptionsUserNameText}" />
        <Border Grid.Column="1" Grid.Row="1" >
            <TextBox Name="tbUsername" />
        </Border>

        <Label Grid.Column="0" Grid.Row="2" Content="{r:Resources OptionsPasswordText}" />
        <Border Grid.Column="1" Grid.Row="2" >
            <TextBox  Name="tbPassword" />
        </Border>

        <Label Grid.Column="0" Grid.Row="3" Content="{r:Resources OptionsDomainText}" />
        <Border Grid.Column="1" Grid.Row="3" >
            <TextBox Name="tbDomain" />
        </Border>

        <Label Grid.Column="0" Grid.Row="4" Content="{r:Resources OptionsLanguageText}" />
        <ComboBox HorizontalAlignment="Left" Width="110" Height="20" x:Name="languageComboBox" 
              Grid.Column="1" Grid.Row="4">
            <ComboBoxItem x:Name="languageComboBoxEnglish" Content="English"/>
            <ComboBoxItem x:Name="languageComboBoxBulgarian" Content="Български"/>
        </ComboBox >


        <CheckBox x:Name="chkCheckForReleaseUpdates" Grid.Column="1" Grid.ColumnSpan="2" Grid.Row="5" Content="{r:Resources OptionsAutomaticCheckForUpdates}" />
        <CheckBox x:Name="chkCheckForBetaUpdates" Grid.Column="1" Grid.ColumnSpan="2" Grid.Row="6" Content="{r:Resources OptionsAutomaticCheckForUpdatesBeta}" IsEnabled="{Binding IsChecked, ElementName=chkCheckForReleaseUpdates}" />

        <Label Grid.Column="0" Grid.Row="7" Content="{r:Resources OptionsAutoSaveEveryText}" />
        <StackPanel Grid.Column="1" Grid.Row="7" Orientation="Horizontal">
            <nud:NumericUpDown x:Name="nudAutoSaveMinutes"
                               Minimum="1" Maximum="60" />
            <Label  Content="{r:Resources OptionsMinutesText}" />
        </StackPanel>


        <Button Grid.Column="1" Grid.Row="8"  Name="btnSave" Content="{r:Resources OptionsSaveText}" 
            Click="SaveClicked" HorizontalAlignment="Left" VerticalAlignment="Bottom" MinWidth="60"
            Height="22" BorderBrush="#FF536B88" Background="{StaticResource BlueButtonStyleBrush}"/>


    </Grid>
</Windows:BookvarToolWindow>